<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="../../../static/layui/css/layui.css" />
		<link rel="stylesheet" href="../../../static/css/bootstrap-theme.min.css" />
		<script src="../../../static/js/jquery-3.3.1.min.js"></script>

	</head>
	<body>
		<div class="layui-card">
			<div class="layui-card-header">
				<h2>个人信息编辑</h2>
			</div>
			<form class="layui-form" id="teacherInfoForm">
				<div class="layui-form-item">
					<label class="layui-form-label">教师ID</label>
					<div class="layui-input-inline">
						<input type="text" name="teacherId" required lay-verify="required" value="${sessionScope.teacher.teacherId}" placeholder="不可编辑" readonly="" autocomplete="off"
						 class="layui-input">
					</div>

				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">教师姓名</label>
					<div class="layui-input-inline">
						<input type="text" name="teacherName" required lay-verify="required" value="${sessionScope.teacher.teacherName}" placeholder="不可编辑" readonly="" autocomplete="off"
						 class="layui-input">
					</div>

				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">教师级别</label>
					<div class="layui-input-inline">
						<input type="text" name="teacherGrade" required lay-verify="required" value="${sessionScope.teacher.teacherGrade}" placeholder="不可编辑" readonly="" autocomplete="off"
						 class="layui-input">
					</div>

				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">教师类型</label>
					<div class="layui-input-inline">
						<input type="text" name="teacherType" required lay-verify="required" value="${sessionScope.teacher.teacherType}" placeholder="不可编辑" readonly="" autocomplete="off"
						 class="layui-input">
					</div>

				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">所属系部</label>
					<div class="layui-input-inline">
						<input type="text" name="department" required lay-verify="required" value="${sessionScope.teacher.department}" placeholder="不可编辑" readonly="" autocomplete="off"
							   class="layui-input">
					</div>

				</div>

				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">个人描述</label>
					<div class="layui-input-block">
						<textarea name="teacherDesc" placeholder="${sessionScope.teacher.teacherDesc}"  class="layui-textarea">${sessionScope.teacher.teacherDesc}</textarea>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn updateTeacher" lay-submit lay-filter="updateTeacher">立即提交</button>
					</div>
				</div>

			</form>
		</div>
		<script src="../../../static/layui/layui.js"></script>
		<script>
			//Demo

			layui.use('form', function() {
				var form = layui.form;

				$(document).ready(function(){

					// 修改信息
					$('.updateTeacher').click(function () {
						console.log($('#teacherInfoForm').serialize())
						$.post(
								"${pageContext.request.contextPath}/updateTeacherInfo",
								$('#teacherInfoForm').serialize(),
								function (data) {
									if (data == 1) {
										var $url = "${pageContext.request.contextPath}" +"/jsp/admin/teacher/info.jsp";
										$(window).attr('location',$url);

									}
								}
						)
					});
				});

			});
		</script>
	</body>
</html>
